<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="/js/jquery-3.2.1.min.js"></script>
<script>
function isWin(userid) {
    //构造一个发送给服务端的参数列表
    var postData = {id:userid};
    $.ajax({
        url:"userAction_isWin.action",
        type:'POST',
        data:postData,
        dataType:'json',//服务端返回类型
        success:function (myresult) {
            if (myresult.data==true){
                alert('恭喜你获奖了');
            }else{
                alert('恭喜你,输了!');
            }
        },
        timeout:3000,
        error:function(){
            alert('访问服务端失败')
        }
    });
}
</script>
</head>
<body>
<table border="1">
    <tr>
        <td>id</td>
        <td>名字</td>
        <td>性别</td>
        <td>年龄</td>
        <td>状态</td>
        <td>是否获奖</td>
    </tr>
<c:forEach items="${userList}"  var="ss">
    <tr>
        <td>${ss.id}</td>
        <td>${ss.userName}</td>
        <td>${ss.sex}</td>
        <td>${ss.age}</td>
        <td>${ss.status}</td>
        <td onclick="isWin(${ss.id})">访问</td>
    </tr>
</c:forEach>
</table>

</body>
</html>